#ifndef CEQUATIONUTILS_H_
#define CEQUATIONUTILS_H_

#include "cmatrix.h"

/**
 * CEquationUtils - provides static methods for solving linear equations
 * @author Michal Rost
 * @date 29.05.2007
 */
template <typename T> class CEquationUtils : public CObject {
public:
  static int solve(const CMatrix<T> &m, const CVector<T> &v, CVector<T> &x,
      CMatrix<T> &so);
  static int solveLU(const CMatrix<T> &m, const CVector<T> &v, CVector<T> &x);
  static string getClassName() {
    return "CEquationUtils";
  }
  static const int EQUATION_SOLUTION_NONE = -1;
  static const int EQUATION_SOLUTION_ONE = 0;
  static const int EQUATION_SOLUTION_INF = 1;
private:
  static void findSolutionU(const CMatrix<T> &m, const CVector<T> &v,
      CVector<T> &x);
  static void findSolutionL(const CMatrix<T> &m, const CVector<T> &v,
      CVector<T> &x);
  static void findAllSolutions(const CMatrix<T> &m, const CVector<T> &v,
      CVector<T> &x, CMatrix<T> &so);
};

#endif
